#ifndef __EVEVNT_INTERNAL_H__
#define __EVEVNT_INTERNAL_H__
#include "event.h"

struct event_s
{
        int             fd;
        time_t          timeout;
        void            *arg;
        short           events;
        short           flags;
        void            (*handle)( int fd, short flags, void *arg );    /**/
        int             idx;
        struct event_s  *prev;
        struct event_s  *next;
};

struct event_ops_s
{
        const char*     name;
        void*           (*init)( struct event_base_s *base, int maxevents );
        int             (*add)( struct event_base_s *base, void *arg, struct event_s *ev );
        int             (*del)(struct event_base_s *base, void *arg, struct event_s *ev );
        int             (*dispatch)( struct event_base_s *base, void *arg, struct timeval *timeout );
        void            (*shutdown)( struct event_base_s *base, void *arg );
};

struct event_base_s
{
        void                    *event_ops_arg;
        struct event_ops_s      *event_ops;
        struct log_s            *log;

        int                     event_total_count;
        int                     event_active_count;

        int                     event_timer_idx;
        time_t                  event_cur_time;

        int                     event_total_size;
        struct event_s          **event_total_array;            /* total event */
        struct event_s          **event_active_array;           /* active event */

        int                     event_timer_size;               /* */
        struct event_s          **event_timer_array;            /* array for per second */
};



#endif
